<template>
  <!-- 客户管理模块-客户信息增加（个人）页面 -->
  <div class="fillcontain baseInfo">
    <!-- 标题 -->
    <div class="fastQuery">
      <el-row>
        <el-col :span="6" class="fastQuery_title">
          <i class="el-icon-tickets"></i><span> 客户信息资料</span></el-col>
        <el-col :span="8"></el-col>
      </el-row>
    </div>
    <div class="contain editInput">
      <el-form v-loading="loading" label-width="120px" class="search_container">
        <el-row class="mt20 common-box">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="customerType">客户类别</label>
            </el-col>
            <el-col :span="16">
              <el-select clearable :disabled="(update == 'Y' && lockMap.customerType)"
                         v-model="customerDetail.customerType" @change="chgCustomerType(customerDetail)">
                <el-option v-for="customertype in customerType" :key="customertype.value" :label="customertype.label"
                           :value="customertype.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="idType">证件类型</label>
            </el-col>
            <el-col :span="16">
              <el-select :disabled="(customerDetail.customerType == 'C'　&&　update== 'Y') || lockMap.idType"
                         v-model="customerDetail.idType">
                <el-option v-for="idtype in idType" :key="idtype.value" :label="idtype.label" :value="idtype.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="idNo">证件号码</label>
            </el-col>
            <el-col :span="16">
              <el-input clearable maxlenth="24" :disabled="lockMap.idNo" v-model="customerDetail.idNo"
                        placeholder="证件号码" @blur="getCardInfo(customerDetail.idNo)"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="iscompany">
            <el-col :span="8" class="common-lab">
              <label class="labelName">统一编码</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" :disabled="lockMap.idNo" v-model="customerDetail.idNo"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="customerName">姓名</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="姓名" :disabled="lockMap.customerName" clearable
                        v-model="customerDetail.customerName"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="validityType">有效期类型</label>
            </el-col>
            <el-col :span="16">
              <el-select clearable :disabled="lockMap.validityType" v-model="customerDetail.validityType"
                         @change="whenChangeFlag(customerDetail.validityType)">
                <el-option v-for="valType in validityType" :key="valType.value" :label="valType.label"
                           :value="valType.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="validityDate">有效期起始日</label>
            </el-col>
            <el-col :span="16">
              <!--<el-date-picker v-if="update" disabled v-model="customerDetail.validityDate" value-format="yyyyMMdd" :picker-options="pickerOptions1"
					            type="date" placeholder="选择日期">
					        </el-date-picker>
					        <el-date-picker v-else v-model="customerDetail.validityDate" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date"
					            placeholder="选择日期">
					        </el-date-picker>-->
              <el-input id="validity" v-bind:disabled="disabledStartValidDate || lockMap.startValidityDate"
                        v-model="customerDetail.startValidityDate"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box" v-if="isperson">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="validityDate">有效期截止日</label>
            </el-col>
            <el-col :span="16">
              <!--<el-date-picker v-if="update" disabled v-model="customerDetail.validityDate" value-format="yyyyMMdd" :picker-options="pickerOptions1"
					            type="date" placeholder="选择日期">
					        </el-date-picker>
					        <el-date-picker v-else v-model="customerDetail.validityDate" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date"
					            placeholder="选择日期">
					        </el-date-picker>-->
              <el-input @blur="checkLength" id="validity" v-bind:disabled="disabledForm || lockMap.validityDate"
                        v-model="customerDetail.validityDate"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="birthday">出生日期</label>
            </el-col>
            <el-col :span="16">
              <!--<el-date-picker v-model="customerDetail.birthday" value-format="yyyyMMdd" :picker-options="pickerOptions2" type="date" placeholder="选择日期">
                            </el-date-picker>-->
              <el-input clearable :disabled="lockMap.birthday" v-model="customerDetail.birthday"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="labelName">性别</label>
            </el-col>
            <el-col :span="16">
              <el-select :disabled="lockMap.sex || lockMap.sexReadOnly" clearable v-model="customerDetail.sex"
                         placeholder="请选择">
                <el-option v-for="item in sexType" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="marryd">婚姻状况</label>
            </el-col>
            <el-col :span="16">
              <el-select :disabled="lockMap.marryd || lockMap.marrydReadOnly" clearable v-model="customerDetail.marryd">
                <el-option v-for="marrydtype in marrydType" :key="marrydtype.value" :label="marrydtype.label"
                           :value="marrydtype.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="nationality">国籍/地区</label>
            </el-col>
            <el-col :span="16">
              <el-col :span="18">
                <el-select :disabled="lockMap.nationality" clearable v-model="customerDetail.nationality"
                           placeholder="请选择">
                  <el-option v-for="item in area" :key="item.nationab" :label="item.nationabcd" :value="item.nationab">
                  </el-option>
                </el-select>
              </el-col>
              <el-col :span="6" style="padding-left:10px!important;" v-if="!lockMap.nationality">
                <el-button type="primary" plain @click="skipAsIdDialogVisible()">选择</el-button>
              </el-col>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="mobilePhoneOne">电话1</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.mobilePhoneOne" clearable placeholder=""
                        v-model="customerDetail.mobilePhoneOne"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="mobilePhoneTwo">电话2</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.mobilePhoneTwo" clearable placeholder=""
                        v-model="customerDetail.mobilePhoneTwo"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="fixedTelephone">移动电话</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.fixedTelephone" clearable placeholder=""
                        v-model="customerDetail.fixedTelephone"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="faxno">传真机号码</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.faxno" clearable placeholder="" v-model="customerDetail.faxno"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="rdidtelno">其他电话</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.rdidtelno" clearable placeholder=""
                        v-model="customerDetail.rdidtelno"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="cltpcode">邮编区号</label>
            </el-col>
            <el-col :span="16">
              <el-input :disabled="lockMap.cltpcode" clearable placeholder=""
                        v-model="customerDetail.cltpcode"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="riskLevel">风险等级</label>
            </el-col>
            <el-col :span="16">
              <el-input disabled placeholder="" v-model="customerDetail.riskLevel"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="email">E-mail</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" :disabled="lockMap.email" v-model="customerDetail.email"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="shippingMethod">信函寄送方式</label>
            </el-col>
            <el-col :span="16">
              <el-select :disabled="lockMap.shippingMethod" v-model="customerDetail.shippingMethod"
                         placeholder="请选择">
                <el-option v-for="item in methodType" :key="item.value" :label="item.label" :value="item.value">
                </el-option>
              </el-select>
              <!--<el-input placeholder="" disabled v-model="customerDetail.shippingMethod">纸质信函</el-input>-->
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="professionalLevel">职业等级</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" disabled v-model="customerDetail.professionalLevel"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="iscompany">
            <el-col :span="8" class="common-lab">
              <label class="unitType">单位性质</label>
            </el-col>
            <el-col :span="16">
              <el-select :disabled="lockMap.unitType" clearable v-model="customerDetail.unitType">
                <el-option v-for="unittype in unittype" :key="unittype.value" :label="unittype.label"
                           :value="unittype.value">
                </el-option>
              </el-select>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="common-box">
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="customerRiskValue">客户风险评测分值</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" disabled v-model="customerDetail.customerRiskValue"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8" v-if="isperson">
            <el-col :span="8" class="common-lab">
              <label class="reason">风险等级原因</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" disabled v-model="customerDetail.reason"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="occpCode">职业信息</label>
            </el-col>
            <el-col :span="16">
              <el-input placeholder="" disabled v-model="customerDetail.occpCode"></el-input>
            </el-col>
          </el-col>
          <el-col :span="8">
            <el-col :span="8" class="common-lab">
              <label class="postalAddress">收费地址</label>
            </el-col>
            <el-col :span="16">
              <el-input clearable placeholder="" :disabled="lockMap.postalAddress"
                        v-model="customerDetail.postalAddress"></el-input>
            </el-col>
          </el-col>
        </el-row>
        <el-row class="mt20">
          <el-col :span="24" class="text_center pr20">
            <el-button type="danger" v-if="checkFlag == 'T' || update=='N'" class="Defaultbutton" @click="checkCus()">
              检查重客
            </el-button>
            <el-button type="danger" class="Defaultbutton" @click="testBlacklist3()">实名查验</el-button>
            <el-button type="danger" class="Defaultbutton" @click="skipIndividualTax()">个人税收居民身份声明文件
            </el-button>
            <el-button type="danger" v-if="update=='Y' && customerDetail.customerType == 'C'" class="Defaultbutton"
                       @click="skipTrustManageDialog()">信托信息管理
            </el-button>
            <el-button type="danger" v-if="customerDetail.unitType=='E'" class="Defaultbutton"
                       @click="skipCopartnerManageDialog()">股东/合伙人信息管理
            </el-button>
            <el-button type="danger" v-if="customerDetail.unitType=='F'" class="Defaultbutton"
                       @click="skipStockDialog()">股权/表决权信息管理
            </el-button>
            <el-button type="danger" v-if="update=='Y'" class="Defaultbutton" @click="skipHistoryDialog()">
              历史修改记录
            </el-button>
            <el-button type="danger" class="Defaultbutton" v-if="checkModify" @click="saveCustomer()">保存</el-button>
            <el-button type="danger" class="dangerbutton" @click="backCustomerList()">返 回</el-button>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 弹框  国籍/地区选择 -->
    <el-dialog title="客户国籍查询" :visible.sync="asIdDialogVisible" width="60%" center>
      <el-row>
        <el-col :span="24">
          <el-col :span="8">
            <el-col :span="6" class="common-lab">
              <label class="labelName">国家</label>
            </el-col>
            <el-col :span="18">
              <el-input clearable placeholder="" v-model="searchParams.nationabdc"></el-input>
            </el-col>
          </el-col>
          <el-col :span="6" class="text_center">
            <el-button type="primary" icon="el-icon-search" @click="skipAsIdDialogVisible()">检索</el-button>
            <el-button type="primary" @click="skipcheckType" plain icon="el-icon-circle-check">选择</el-button>
          </el-col>
        </el-col>
        <el-col :span="24" class="mt20">
          <el-table :data="asIdTableData" @row-click="checkNation" style="width: 100%">
            <el-table-column label="" width="65">
              <template slot-scope="scope">
                <el-radio class="radio" v-model="templateSelection" :label="scope.$index">&nbsp;</el-radio>
              </template>
            </el-table-column>
            <el-table-column prop="nationabcd" label="国家">
            </el-table-column>
            <el-table-column prop="nationab" v-if='show'>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="pagination">
            <el-pagination background v-if='paginations3.total > 0' :page-sizes="paginations3.pageSizes"
                           :page-size="paginations3.pageSize"
                           :layout="paginations3.layout" :total="paginations3.total"
                           :current-page='paginations3.pageIndex'
                           @current-change='handleCurrentChange3' @size-change='handleSizeChange3'>
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" class="dangerbutton" @click="asIdDialogVisible = false">返 回</el-button>
      </span>
    </el-dialog>

    <!--检查重客信息-->
    <el-dialog title="客户信息查询" :visible.sync="isCheckVisible" width="60%" center>
      <div class="table_container">
        <el-table :data="tableDataInfo" @row-click="checkClntnum" highlight-current-row
                  header-cell-class-name="table-header-class"
                  style="width:100%">

          <el-table-column width="120" property="clntnum" label="客户号" align='center'>
          </el-table-column>
          <el-table-column width="80" property="validflag" :formatter="isvalidflag" label="有效性" align='center'>
          </el-table-column>
          <el-table-column width="80" property="clttype" :formatter="isclttype" label="客户类型" align='center'>
          </el-table-column>
          <el-table-column width="200" property="secuityno" label="证件号码" align='center'>
          </el-table-column>
          <el-table-column width="120" property="surname" label="客户姓名" align='center'>
          </el-table-column>
          <el-table-column width="80" property="cltsex" :formatter="iscltsex" label="性别" align='center'>
          </el-table-column>
          <el-table-column width="120" property="as_cltdob" label="出生日期" align='center'>
          </el-table-column>
          <el-table-column width="120" property="ctrycode" label="国籍" align='center'>
          </el-table-column>
          <el-table-column width="120" property="cltphone01" label="电话1" align='center'>
          </el-table-column>
          <el-table-column width="120" property="cltphone02" label="电话2" align='center'>
          </el-table-column>
          <el-table-column width="120" property="marryd" :formatter="ismarryd" label="婚姻状况" align='center'>
          </el-table-column>
          <el-table-column width="120" property="faxno" label="传真机号码" align='center'>
          </el-table-column>
        </el-table>
        <el-row>
          <el-col :span="24">
            <div class="pagination">
              <el-pagination background v-if='paginations1.total > 0' :page-sizes="paginations1.pageSizes"
                             :page-size="paginations1.pageSize"
                             :layout="paginations1.layout" :total="paginations1.total"
                             :current-page='paginations1.pageIndex'
                             @current-change='handleCurrentChange1' @size-change='handleSizeChange1'>
              </el-pagination>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-dialog>
    <!--弹框  历史修改记录 -->
    <el-dialog title="历史修改记录" :visible.sync="historyDialog" width="60%" center>
      <el-row>
        <el-col :span="24">
          <el-table :data="historyTableData" style="width: 100%">
            <el-table-column prop="source" label="来源" min-width="80">核保系统</el-table-column>
            <el-table-column prop="type" label="修改类型" min-width="100" :formatter="modifyType" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="lastUpdateTime" label="修改时间" min-width="160" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="lastUpdateId" label="修改人员" min-width="120" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="oldVal" label="修改前" min-width="100" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="newVal" label="修改后" min-width="100" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="itemName" label="修改字段名" :formatter="isitemName" min-width="100"
                             show-overflow-tooltip>
            </el-table-column>
          </el-table>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="pagination">
            <el-pagination background v-if='paginations2.total > 0' :page-sizes="paginations2.pageSizes"
                           :page-size="paginations2.pageSize"
                           :layout="paginations2.layout" :total="paginations2.total"
                           :current-page='paginations2.pageIndex'
                           @current-change='handleCurrentChange2' @size-change='handleSizeChange2'>
            </el-pagination>
          </div>
        </el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" class="dangerbutton" @click="historyDialog = false">返 回</el-button>
      </span>
    </el-dialog>

    <!--弹框  信托信息管理 -->
    <el-dialog title="信托信息管理" :visible.sync="trustManageDialog" width="60%" center>
      <el-form ref="form" :model="form" label-width="120px">
        <el-row>
          <el-col :span="24">
            <div class="title">
              <span>信托投保人</span>
            </div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="单位名称">
                  <el-input clearable v-model.trim="cltrp.lsurname"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件类型">
                  <el-select clearable v-model.trim="cltrp.cltind">
                    <el-option value="L" label="企业法人营业执照"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号码">
                  <el-input clearable v-model.trim="cltrp.secuityno"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期类型">
                  <el-select clearable v-model.trim="cltrp.rinternet" placeholder="">
                    <el-option value="3" label="缺省"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期截止日">
                  <!--<el-date-picker v-model.trim="cltrp.cltdod" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date" placeholder="选择日期">
                                    </el-date-picker>-->
                  <el-input clearable v-model.trim="cltrp.cltdod"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="联系地址">
                  <el-input clearable v-model.trim="cltrp.cmntdesc"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
          <el-col :span="24" class="mt20">
            <div class="title">
              <span>法定代表人/主要负责人</span>
            </div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名">
                  <el-input clearable v-model.trim="cltrl.lsurname"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件类型">
                  <el-select clearable v-model.trim="cltrl.cltind" placeholder="">
                    <el-option v-for="item in idType" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号码">
                  <el-input clearable v-model.trim="cltrl.secuityno"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="职务">
                  <el-select clearable v-model.trim="cltrl.role" placeholder="">
                    <el-option value="L" label="法定代表人"></el-option>
                    <el-option value="M" label="主要负责人"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期类型">
                  <el-select clearable v-model.trim="cltrl.rinternet" placeholder="">
                    <el-option value="1" label="终身"></el-option>
                    <el-option value="2" label="年期"></el-option>
                    <el-option value="3" label="缺省"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期截止日">
                  <!--<el-date-picker v-model.trim="cltrl.cltdod" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date" placeholder="选择日期">
                                    </el-date-picker>-->
                  <el-input clearable v-model.trim="cltrl.cltdod"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="国家/地区">
                  <el-select clearable v-model="cltrl.natlty" placeholder="请选择">
                    <el-option v-for="item in area" :key="item.nationab" :label="item.nationabcd"
                               :value="item.nationab">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="是否黑名单">
                  <el-select clearable v-model.trim="cltrl.blacklist" placeholder="">
                    <el-option value="Y" label="是"></el-option>
                    <el-option value="N" label="否"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="联系地址">
                  <el-input clearable v-model.trim="cltrl.cmntdesc"></el-input>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="danger" class="Defaultbutton" @click="testBlacklist">黑名单检测</el-button>
        <el-button type="danger" class="Defaultbutton" @click="saveTrustManage">保存</el-button>
        <el-button type="danger" class="dangerbutton" @click="backDetail">返 回</el-button>
      </span>
    </el-dialog>

    <!--弹框  股东合伙人信息管理 -->
    <el-dialog title="股东合伙人信息管理" :visible.sync="copartnerManageDialog" width="50%" center>
      <el-form ref="form" label-width="120px">
        <el-row>
          <el-col :span="24">
            <div v-for="(copartnerInfo,index) in copartner">
              <div class="title">
                <span>所有人{{ index + 1 }}</span>
              </div>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="姓名">
                    <el-input clearable v-model="copartnerInfo.lsurname"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="证件类型">
                    <el-select clearable v-model="copartnerInfo.cltind" placeholder="">
                      <el-option v-for="item in idType" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="证件号码">
                    <el-input clearable v-model="copartnerInfo.secuityno"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="国家/地区">
                    <el-select clearable v-model="copartnerInfo.natlty" placeholder="">
                      <el-option v-for="item in area" :key="item.nationab" :label="item.nationabcd"
                                 :value="item.nationab">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="有效期类型">
                    <el-select clearable v-model.trim="copartnerInfo.rinternet" placeholder="">
                      <el-option value="1" label="终身"></el-option>
                      <el-option value="2" label="年期"></el-option>
                      <el-option value="3" label="缺省"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="有效期截止日">
                    <!--<el-date-picker v-model="copartnerInfo.cltdod" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date" placeholder="选择日期">
                                        </el-date-picker>-->
                    <el-input clearable v-model="copartnerInfo.cltdod"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="合伙权益比例(%)">
                    <el-input clearable v-model="copartnerInfo.paypct01"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否黑名单">
                    <el-select clearable v-model="copartnerInfo.blacklist" placeholder="">
                      <el-option value="Y" label="是"></el-option>
                      <el-option value="N" label="否"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="联系地址">
                    <el-input clearable v-model="copartnerInfo.cmntdesc"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
                <el-button type="danger" class="Defaultbutton" @click="testBlacklist1()">黑名单检测</el-button>
                <el-button type="danger" class="Defaultbutton" @click="saveCopartner()">保存</el-button>
                <el-button type="danger" class="Defaultbutton" @click="addCopartner()">增加</el-button>
                <el-button type="danger" class="dangerbutton" @click="copartnerManageDialog = false">返 回</el-button>
            </span>
    </el-dialog>

    <!--弹框  股权/表决权信息管理 -->
    <el-dialog title="股权/表决权信息管理" :visible.sync="stockDialog" width="50%" center>
      <el-form ref="form" :model="shcltr" label-width="120px">
        <el-row>
          <el-col :span="24">
            <div class="title">
              <span>其他实际控制公司或企业所有人</span>
            </div>
            <el-row>
              <el-col :span="12">
                <el-form-item label="姓名">
                  <el-input clearable v-model="shcltr.lsurname"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件类型">
                  <el-select clearable v-model="shcltr.cltind" placeholder="">
                    <el-option v-for="item in idType" :key="item.value" :label="item.label" :value="item.value">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="证件号码">
                  <el-input clearable v-model="shcltr.secuityno"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="国家/地区">
                  <el-select clearable v-model="shcltr.natlty" placeholder="">
                    <el-option v-for="item in area" :key="item.nationab" :label="item.nationabcd"
                               :value="item.nationab">
                    </el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期类型">
                  <el-select clearable v-model="shcltr.rinternet" placeholder="">
                    <el-option value="1" label="终身"></el-option>
                    <el-option value="2" label="年期"></el-option>
                    <el-option value="3" label="缺省"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="有效期截止日">
                  <!--<el-date-picker v-model="shcltr.cltdod" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date" placeholder="选择日期">
                                    </el-date-picker>-->
                  <el-input clearable v-model="shcltr.cltdod"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="12">
                <el-form-item label="是否黑名单">
                  <el-select clearable v-model="shcltr.blacklist" placeholder="">
                    <el-option value="Y" label="是"></el-option>
                    <el-option value="N" label="否"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="联系地址">
                  <el-input clearable v-model="shcltr.cmntdesc"></el-input>
                </el-form-item>
              </el-col>
              <el-col :span="24">
                <el-form-item label="控制方式">
                  <el-radio-group v-model="shcltr.conttyp">
                    <p class="pt10">
                      <el-radio label="1">有权决定公司或者企业的人事任免，并可据以从其经营活动中获取利益</el-radio>
                    </p>
                    <p class="pt10">
                      <el-radio label="2">有权决定公司或者企业的财务事项，并可据以从其经营活动中获取利益</el-radio>
                    </p>
                    <p class="pt10">
                      <el-radio label="3">有权决定公司或者企业的经营决策，并可据以从其经营活动中获取利益</el-radio>
                    </p>
                  </el-radio-group>
                </el-form-item>
              </el-col>
            </el-row>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <div class="title">
              <span>直接或简介拥有股权或表决权者</span>
            </div>
            <div v-for="(shcltrInfo,index) in shcltrList">
              <div class="">
                <span>所有人{{ index + 1 }}</span>
              </div>
              <el-row>
                <el-col :span="12">
                  <el-form-item label="姓名">
                    <el-input v-model="shcltrInfo.lsurname"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="证件类型">
                    <el-select clearable v-model="shcltrInfo.cltind" placeholder="">
                      <el-option v-for="item in idType" :key="item.value" :label="item.label" :value="item.value">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="证件号码">
                    <el-input v-model="shcltrInfo.secuityno"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="国家/地区">
                    <el-select clearable v-model="shcltrInfo.natlty" placeholder="">
                      <el-option v-for="item in area" :key="item.nationab" :label="item.nationabcd"
                                 :value="item.nationab">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="有效期类型">
                    <el-select clearable v-model="shcltrInfo.rinternet" placeholder="">
                      <el-option value="1" label="终身"></el-option>
                      <el-option value="2" label="年期"></el-option>
                      <el-option value="3" label="缺省"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="有效期截止日">
                    <!--<el-date-picker v-model="shcltrInfo.cltdod" value-format="yyyyMMdd" :picker-options="pickerOptions1" type="date" placeholder="选择日期">
                                        </el-date-picker>-->
                    <el-input clearable v-model="shcltrInfo.cltdod"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="持股比例(%)">
                    <el-input v-model="shcltrInfo.paypct02"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="表决权比例(%)">
                    <el-input v-model="shcltrInfo.paypct03"></el-input>
                  </el-form-item>
                </el-col>
                <el-col :span="12">
                  <el-form-item label="是否黑名单">
                    <el-select clearable v-model="shcltrInfo.blacklist" placeholder="">
                      <el-option value="Y" label="是"></el-option>
                      <el-option value="N" label="否"></el-option>
                    </el-select>
                  </el-form-item>
                </el-col>
                <el-col :span="24">
                  <el-form-item label="联系地址">
                    <el-input v-model="shcltrInfo.cmntdesc"></el-input>
                  </el-form-item>
                </el-col>
              </el-row>
            </div>
          </el-col>
        </el-row>
      </el-form>
      <span slot="footer" class="dialog-footer">
                <el-button type="danger" class="Defaultbutton" @click="testBlacklist2()">黑名单检测</el-button>
                <el-button type="danger" class="Defaultbutton" @click="addStock()">增加</el-button>
                <el-button type="danger" class="Defaultbutton" @click="saveStock()">保存</el-button>
                <el-button type="danger" class="dangerbutton" @click="stockDialog = false">返 回</el-button>
            </span>
    </el-dialog>
    <!-- 弹框 查验 -->
    <el-dialog title="查验补充信息" :visible.sync="checkManageDialog" width="60%" center>
      <el-form label-width="80px">
        <el-row>
          <el-col :span="8">
            <el-form-item label="受理号">
              <el-input clearable v-model.trim="checkInfo.applnum"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="保单号">
              <el-input clearable v-model.trim="checkInfo.chdrnum"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="业务类型">
              <el-select clearable v-model.trim="checkInfo.buscode">
                <el-option value="101" label="101 - 投保申请"></el-option>
                <el-option value="201" label="201 - 理赔申请"></el-option>
                <el-option value="501" label="501 - 批改申请"></el-option>
                <el-option value="503" label="503 - 退保申请"></el-option>
                <el-option value="701" label="701 - 贷款申请"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <span slot="footer" class="dialog-footer">
		  <el-button type="danger" class="Defaultbutton" @click="saveCheckManage()">保存</el-button>
		  <el-button type="danger" class="dangerbutton" @click="checkManageDialog=!checkManageDialog">返 回</el-button>
		</span>
    </el-dialog>

  </div>
</template>
<script>
import moment from 'moment';
import constant from '@/utils/constant';
import {mapState, mapGetters} from 'vuex'
import manageConstants from '@/utils/manageConstants';
import {
  saveCustomerInfo,
  getCustomerInfoDetail,
  checkBlacklistInfo,
  trustManage,
  getHistoryRecord,
  getNationList,
  getNationPageList,
  saveTrustManageInfo,
  saveCopartnerManage,
  saveStockInfo,
  checkModify,
  saveCheckManage
} from "@/api/customermanage/customerManage.js";
import {getToken, setCookie} from '@/utils/auth';

export default {
  data() {
    return {
      asIdDialogVisible: false,//默认隐藏 国籍/地区弹框
      trustManageDialog: false,//默认隐藏 信托信息管理弹框
      copartnerManageDialog: false,//默认隐藏 股东合伙人信息管理弹框
      stockDialog: false,//默认隐藏股权/表决权信息管理弹框
      templateSelection: '',
      historyDialog: false,
      iscompany: false,
      isCheckVisible: false,
      checkManageDialog: false,
      // 查验条件对象
      checkInfo: {
        applnum: '',
        chdrnum: '',
        buscode: ''
      },
      isperson: true,
      isCheck: false,
      show: false,
      isSave: false,
      isSaveSto: false,
      update: 'N',
      // checkType: false,
      shcltr: {},
      copartner: [{}],
      shcltrList: [{}],
      sexType: manageConstants.sexType,
      form: {},
      loading: false,
      historyTableData: [],
      area: [],
      record: false,
      copartnerInfo: {},
      tableDataInfo: [],
      paginations1: {
        total: 0,        // 总数
        pageIndex: 1,  // 当前位于哪页
        pageSize: 10,   // 1页显示多少条
        pageSizes: [5, 10, 15, 20],  //每页显示多少条
        layout: "total, sizes, prev, pager, next, jumper"   // 翻页属性
      },
      paginations2: {
        total: 0,        // 总数
        pageIndex: 1,  // 当前位于哪页
        pageSize: 10,   // 1页显示多少条
        pageSizes: [5, 10, 15, 20],  //每页显示多少条
        layout: "total, sizes, prev, pager, next, jumper"   // 翻页属性
      },
      paginations3: {
        total: 0,        // 总数
        pageIndex: 1,  // 当前位于哪页
        pageSize: 10,   // 1页显示多少条
        pageSizes: [5, 10, 15, 20],  //每页显示多少条
        layout: "total, sizes, prev, pager, next, jumper"   // 翻页属性
      },
      cltrp: {},
      cltrl: {},
      customerNo: '',
      sourcePage: '',
      customerType: manageConstants.customerType,
      idType: manageConstants.idType,
      validityType: manageConstants.validityType,
      marrydType: manageConstants.marrydType,
      unittype: manageConstants.unittype,
      options: manageConstants.options,
      methodType: manageConstants.methodType,
      customerDetail: {},
      nationality: '',
      nationab: '',
      customerOldInfo: {
        surname: "",
        roleflag35: "",
        secuityno: "",
        as_flag: "",
        as_dateup01: "",
        as_dateup03: "",
        cltphone01: "",
        cltphone02: "",
        rmblphone: "",
        as_address: "",
        asClrr: "",
      },
      customerAlterVO: {},
      searchParams: {
        nationabdc: ''
      },
      asIdTableData: [],
      value: '',
      addCon: 1,
      addSto: 1,
      disabledForm: true,
      disabledStartValidDate: true,
      checkFlag: 'T',
      pickerOptions1: {
        disabledDate(time) {
          return time.getTime() < Date.now();
        }
      },
      pickerOptions2: {
        disabledDate(time) {
          return time.getTime() > Date.now();
        }
      },
      aCity: {
        11: "北京", 12: "天津", 13: "河北", 14: "山西", 15: "内蒙古", 21: "辽宁", 22: "吉林", 23: "黑龙江", 31: "上海",
        32: "江苏", 33: "浙江", 34: "安徽", 35: "福建", 36: "江西", 37: "山东", 41: "河南", 42: "湖北", 43: "湖南",
        44: "广东", 45: "广西", 46: "海南", 50: "重庆", 51: "四川", 52: "贵州", 53: "云南", 54: "西藏", 61: "陕西",
        62: "甘肃", 63: "青海", 64: "宁夏", 65: "新疆", 71: "台湾", 81: "香港", 82: "澳门", 91: "国外"
      },
      checkModify: false,
      lockMap: {
        customerType: false,
        idNo: false,
        customerName: false,
        validityDate: false,
        startValidityDate: false,
        marryd: false,
        idType: false,
        birthday: false,
        sex: false,
        fixedTelephone: false,
        rdidtelno: false,
        validityType: false,
        nationality: false,
        mobilePhoneOne: false,
        mobilePhoneTwo: false,
        faxno: false,
        cltpcode: false,
        email: false,
        shippingMethod: false,
        unitType: false,
        postalAddress: false,
        marrydReadOnly: false,
        sexReadOnly: false,
      }
    }
  },
  activated() {
    for (const argumentsKey in this.lockMap) {
      this.lockMap[argumentsKey] = false;
    }
    this.checkModify = false;
    this.customerDetail.shippingMethod = '2';
    //页面初始化方法
    let update = this.$route.query.update;
    if (update != null) {
      this.update = update;
      this.isCheck = false;

    }
    if (update == 'Y') {
      this.lockMap.email = true;
      this.lockMap.customerType = true;
      this.getCustomerInfo();
    } else {
      this.getCheckModify();
      this.iscompany = false;
      this.isperson = true;
      this.lockMap.email = false;
      this.lockMap.customerType = false;
    }
    this.initNation();

  },
  methods: {
    // 实名查验保存
    /*saveCheckManage() {
				let that = this;
				let params = {
					applnum: this.checkInfo.applnum,
					chdrnum: this.checkInfo.chdrnum,
					name: this.customerDetail.customerName,
					certNo: this.customerDetail.idNo,
					certTypeCode:this.customerDetail.idType,
					certStart:this.customerDetail.startValidityDate,
					certEnd:this.customerDetail.validityDate,
					buscode: this.checkInfo.buscode,
					clntnum:this.customerDetail.customerNo
				}

				if(params.buscode == '') {
					that.popMsg("请选择业务类型", "error");
					return;
				}
				if (!that.checkInfo.chdrnum) {
					that.popMsg("请输入保单号码", "error");
					return;
				}
				saveCheckManage(params).then(res => {
				    this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
				    if (res.resultCode == constant.SUCCESS && res.data) {
                        if (res.data.result == '1') {
                            that.popMsg("查验通过: " + res.data.resultExt, "success");
                            that.checkManageDialog = false;
                        } else {
                            that.popMsg("查验不通过: " + res.data.resultExt, "error");
                        }
				    }
				}).catch(err => {
				    this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
				})
			},*/
    whenChangeFlag(obj) {
      if (obj == "1") {
        this.$set(this.customerDetail, 'validityDate', '99999999')
        this.$set(this.customerDetail, 'startValidityDate', '0')
        this.disabledForm = true;
        this.disabledStartValidDate = false;
      } else if (obj == "3") {
        this.$set(this.customerDetail, 'validityDate', '0')
        this.$set(this.customerDetail, 'startValidityDate', '0')
        this.disabledForm = true;
        this.disabledStartValidDate = true;
      } else {
        this.disabledForm = false;
        this.disabledStartValidDate = false;
      }
    },
    initNation() {
      getNationList().then(res => {
        if (res.resultCode == constant.SUCCESS && res.data.length > 0) {
          this.area = res.data;
        }
      }).catch(err => {
        this.$emit('checkData', false)
      })
    },
    getCustomerInfo() {
      this.customerNo = this.$route.query.customerNo;
      this.sourcePage = this.$route.query.sourcePage;
      let sourcePageinfo = this.sourcePage ? this.sourcePage : "customerInfoModify";
      let params = {
        customerNo: this.customerNo,
        sourcePage: sourcePageinfo
      }
      this.$store.dispatch('loading/CHNAGE_SUBLOADING', true)
      getCustomerInfoDetail(params).then(res => {
        this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
        if (res.resultCode == constant.SUCCESS && res.data) {
          this.customerDetail = res.data;
          this.customerOldInfo.surname = res.data.customerName;
          this.customerOldInfo.roleflag35 = res.data.idType;
          this.customerOldInfo.secuityno = res.data.idNo;
          this.customerOldInfo.as_flag = res.data.validityType;
          this.customerOldInfo.as_dateup01 = res.data.validityDate;
          this.customerOldInfo.as_dateup03 = res.data.startValidityDate;
          this.customerOldInfo.cltphone01 = res.data.mobilePhoneOne;
          this.customerOldInfo.cltphone02 = res.data.mobilePhoneTwo;
          this.customerOldInfo.rmblphone = res.data.fixedTelephone;
          this.customerOldInfo.as_address = res.data.postalAddress;
          this.checkModify = this.customerDetail.checkModify;
          // this.checkModify = true;
          //可编辑
          this.checkLock();
          if (res.data.customerType == 'C' || (res.data.cltind != "Y" && res.data.cltind != "")) {
            this.checkFlag = 'F';
          }
          if (res.data.customerType == 'P') {
            this.isperson = true;
            this.iscompany = false;
          }
          if (res.data.customerType == 'C') {
            this.iscompany = true;
            this.isperson = false;
          }
          if (res.data.validityType == "1") {
            this.$set(this.customerDetail, 'validityDate', '99999999')
            this.disabledForm = true;
            this.disabledStartValidDate = false;
          } else if (res.data.validityType == "3") {
            this.$set(this.customerDetail, 'validityDate', '0')
            this.$set(this.customerDetail, 'startValidityDate', '0')
            this.disabledForm = true;
            this.disabledStartValidDate = true;
          } else {
            this.disabledForm = false;
            this.disabledStartValidDate = false;
          }
        }
        this.$emit('checkData', this.tableData.length > 0 ? true : false)
      }).catch(err => {
        this.$emit('checkData', false)
        this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
      })
    },
    chgCustomerType(customerDetail) {
      if (this.customerDetail.customerType == "P") {//客户
        this.iscompany = false;
        this.isperson = true;
      } else if (this.customerDetail.customerType == "C") {//公司
        this.isperson = false;
        this.iscompany = true;
      }
    },

    //检查重客
    checkCus() {
      this.isCheck = true;
      if (this.customerDetail.customerName == null || this.customerDetail.customerName.length == 0) {
        this.popMsg("注意:请输入客户姓名", "error");
        return false;
      }
      if (this.customerDetail.customerType == 'C') {
        this.customerDetail.birthday = '99999999'
        this.customerDetail.sex = ''
      }

      if (this.customerDetail.customerType == 'P' && (this.customerDetail.sex == null || this.customerDetail.sex.length == 0)) {
        this.popMsg("注意:请输入客户性别", "error");
        return false;
      }
      if (this.customerDetail.customerType == 'P') {
        if (this.customerDetail.idNo == null || this.customerDetail.idNo.length == 0) {
          this.popMsg("注意:请输入客户证件号", "error");
          return false;
        }
      }
      let param = {
        "surname": this.customerDetail.customerName,
        "clttype": this.customerDetail.customerType,
        "cltdob": this.customerDetail.birthday,
        "cltsex": this.customerDetail.sex,
        "secuityno": this.customerDetail.idNo,
        "pageSize": this.paginations1.pageSize,
        "pageNumber": this.paginations1.pageIndex,
      }
      let that = this;
      this.$.ajax({
        headers: {
          Authorization: getToken(constant.TOKEN) || ''
        },
        url: constant.customerApi + '/customermanage/customerInfo/check',//url路径
        type: 'POST', //GET
        async: false, //或false,是否异步
        data: JSON.stringify(param),
        contentType: "application/json;charset=UTF-8",
        success: function (res, textStatus, jqXHR) {
          if (res.resultCode == constant.SUCCESS && res.data) {
            if (res.data.list.length > 0) {
              that.tableDataInfo = res.data.list;
              that.paginations1.total = res.data.total;
              that.isCheckVisible = true;
              that.popMsg(res.resultMsg, "success");
            }

          } else {
            that.popMsg("没有重客信息", "error");
          }
        }
      }).catch(err => {
        this.popMsg("重客记录查询失败", "error");
      })
    },
    //保存客户信息
    saveCustomer() {
      if (this.isCheck == false && this.update != 'Y') {
        this.popMsg("请检查重客", "error");
        return;
      }
      this.getCustomerAlterVO();
      if (this.customerAlterVO.clttype == 'P' && !this.checkBirthday(this.customerDetail.birthday)) {
        return;
      }
      this.checkCustomerType();
    },
    //保存客户信息
    re_saveCustomer() {
      if (this.customerAlterVO.clttype == null || this.customerAlterVO.clttype == "") {
        this.popMsg("注意:客户类别不能为空!", "error");
        return;
      }
      let surname_s = this.customerAlterVO.surname.trim();
      if (surname_s == null || surname_s == "") {
        this.popMsg("注意:姓名不能为空!", "error");
        return;
      } else {
        let chinese_flag = false;	//非英文标识判定,默认false,无2位占位符
        let v = surname_s.trim();
        let char = "";
        let len = 29;
        let templen = 0;
        for (let i = 0; i < v.length; i++) {
          char = v.charCodeAt(i);
          if (!(char > 255)) {
            templen = templen + 1;
          } else {
            templen = templen + 2;
            chinese_flag = true;
          }
        }

        if (chinese_flag) {
          if ((len - 1) < templen) {
            this.popMsg("注意!输入长度不能超出限制!", "error");
            return false;
          } else {

          }
        } else {
          if (len < templen) {
            this.popMsg("注意!输入长度不能超出限制!", "error");
            return false;
          } else {

          }
        }
      }
      // if (surname_s && surname_s.length > 15) {
      //     this.popMsg("注意！姓名长度不能超出字符15位！中文7.5位！", "error");
      //     return;
      //}

      if (this.customerAlterVO.clttype == 'P') {
        if (this.customerAlterVO.secuityno == null || this.customerAlterVO.secuityno == "") {
          this.popMsg("注意:证件号不能为空!", "error");
          return;
        }
      }
      if (this.customerAlterVO.ctrycode == null || this.customerAlterVO.ctrycode == "") {
        this.popMsg("注意:国籍代码不能为空！", "error");
        return;
      }
      if (this.customerAlterVO.clttype == 'P' && (this.customerAlterVO.cltdob == null || this.customerAlterVO.cltdob == "")) {
        this.popMsg("注意：出生日期不能为空!", "error");
        return;
      }
      let cltTimeNew = this.getCltDate();
      if (this.customerAlterVO.clttype == 'P' && this.customerAlterVO.cltdob > cltTimeNew) {
        this.popMsg("注意:出生日期不得大于系统当前时间", "error");
        return;
      }
      if (this.customerAlterVO.clttype == 'P' && (this.customerAlterVO.cltsex == null || this.customerAlterVO.cltsex == "")) {
        this.popMsg("注意:客户性别不能为空!", "error");
        return;
      }

      if (this.customerAlterVO.cltphone01) {
        let cltphone01_s = this.customerAlterVO.cltphone01.trim();
        let reg = /^[0-9]*$/
        let repl = new RegExp(reg);
        if (!repl.test(cltphone01_s)) {
          this.popMsg("注意:固定号码必须为纯数字!", "error");
          return;
        }
        if (cltphone01_s && cltphone01_s.length > 16) {
          this.popMsg("注意！固定号码长度超出6位了!", "error");
          return;
        }

      }
      if (this.customerAlterVO.cltpcode == null || this.customerAlterVO.cltpcode == "") {
        this.popMsg("注意:邮编区号不能为空!", "error");
        return;
      }

      if (this.customerAlterVO.cltpcode) {
        let cltpcode_s = this.customerAlterVO.cltpcode.trim();
        let reg = /^[0-9]*$/
        let repl = new RegExp(reg);
        if (!repl.test(cltpcode_s)) {
          this.popMsg("注意:邮编区号必须为纯数字!", "error");
          return;
        }
        if (cltpcode_s.length > 6) {
          this.popMsg("注意！邮编区号长度超出6位了!", "error");
          return;
        }
      }

      if (this.customerAlterVO.as_flag == null || this.customerAlterVO.as_flag == '') {
        this.popMsg("注意！有效期类型不能为空", "error");
        return;
      }
      let is_before = false;
      if (this.customerAlterVO.roleflag35 == '1') {
        is_before = moment(this.customerAlterVO.as_dateup03).isBefore("20040329");
        if (is_before) {
          this.popMsg("注意！证件类型为身份证时，有效期起始日不得小于二代身份证生效日", "error");
          return;
        }
      }
      if (this.customerAlterVO.as_flag == 2) {
        let asFlag = this.customerAlterVO.as_flag.trim();
        if (this.customerAlterVO.as_dateup03 == null || this.customerAlterVO.as_dateup03 == "") {
          alert("注意！有效期类型为年期时，有效期起始日不能为空!");
          return;
        }
        if (this.customerAlterVO.as_dateup01 == null || this.customerAlterVO.as_dateup01 == "") {
          this.popMsg("注意！有效期类型为年期时，有效期截止日不得为空", "error");
          return;
        }
        if (this.customerAlterVO.as_dateup03 == 0) {
          this.popMsg("注意！有效期类型为年期时，有效期起始日不得为0", "error");
          return;
        }
        if (this.customerAlterVO.as_dateup01 == 0) {
          this.popMsg("注意！有效期类型为年期时，有效期截止日不得为0", "error");
          return;
        }
        //有效期不能大于当前日期。截止日不能大于起始日
        let now = moment().format("YYYYMMDD");
        is_before = moment(this.customerAlterVO.as_dateup03).isAfter(now);
        if (is_before) {
          this.popMsg("注意！有效期类型为年期时，有效期起始日不得大于当前日", "error");
          return;
        }
        is_before = moment(this.customerAlterVO.as_dateup01).isBefore(this.customerAlterVO.as_dateup03);
        if (is_before) {
          this.popMsg("注意！有效期类型为年期时，有效期截止日不得小于起始日", "error");
          return;
        }
        is_before = moment(this.customerAlterVO.as_dateup03).isBefore(this.customerAlterVO.cltdob);
        if (is_before) {
          this.popMsg("注意！有效期类型为年期时，有效期起始日不得小于出生日", "error");
          return;
        }
      }

      if (this.customerAlterVO.cltphone01) {
        let cltphone01_s = this.customerAlterVO.cltphone01.trim();
        let reg = /^[0-9]*$/
        let repl = new RegExp(reg);
        if (!repl.test(cltphone01_s)) {
          this.popMsg("注意！电话1只能为数字", "error");
          return;
        }
        if (cltphone01_s.length > 16) {
          this.popMsg("注意！电话1长度超出16位了", "error");
          return false
        }
      }

      if (this.customerAlterVO.cltphone02) {
        let cltphone02_s = this.customerAlterVO.cltphone02.trim();
        let reg = /^[0-9]*$/
        let repl = new RegExp(reg);
        if (!repl.test(cltphone02_s)) {
          this.popMsg("注意！电话2只能为数字", "error");
          return;
        }
        if (cltphone02_s.length > 16) {
          this.popMsg("注意！电话2长度超出16位了", "error");
          return;
        }
      }

      if (this.customerAlterVO.faxno) {
        let reg = /^[0-9]*$/
        let repl = new RegExp(reg);
        let faxno_s = this.customerAlterVO.faxno.trim();
        if (!repl.test(faxno_s)) {
          this.popMsg("注意！传真号码只能为数字", "error");
          return;
        }
        if (faxno_s.length > 16) {
          this.popMsg("注意！传真号码长度超出16位了", "error");
          return;
        }
      }

      if (this.customerAlterVO.clttype == "C" && (this.customerAlterVO.flag03 == null || this.customerAlterVO.flag03 == "")) {//当客户类型为公司C时，进行单位性质验证
        this.popMsg("请选择单位性质", "error");
        return;
      }

      if (this.customerAlterVO.email) {
        let email_s = this.customerAlterVO.email.trim();
        let regEmail = /^[a-z0-9A-Z\u4e00-\u9fa5]+[- | a-z0-9A-Z . _]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
        let repl = new RegExp(regEmail);
        if (!repl.test(email_s)) {
          this.popMsg("注意！请输入正确的邮箱编码", "error");
          return;
        }
      }
      let iden = this.customerAlterVO.secuityno;
      // let checkRule = /[\u4e00-\u9fa5]/g;
      // if (iden && checkRule.test(iden)) {
      //     this.popMsg("注意！证件号码不能有中文！", "error");
      //     return;
      // }
      if (iden && this.customerDetail.customerType == 'P' && (this.customerAlterVO.roleflag35 == '1' || this.customerAlterVO.roleflag35 == '7')) {
        let idCheck = this.checkIdno(iden);
        if (idCheck == null) {
          this.popMsg("注意！身份证信息不合法", "error");
          return;
        }
        if (iden.length == 15) {
          let birth = "19" + iden.substring(6, 8) + iden.substring(8, 10) + iden.substring(10, 12);
          if (this.customerAlterVO.cltdob != birth) {
            this.popMsg("注意！出生日期与身份证号码不匹配", "error");
            return;
          }
        }
        if (iden.length == 18) {
          let birth = iden.substring(6, 10) + iden.substring(10, 12) + iden.substring(12, 14);
          if (iden.indexOf("X") > 0 && iden.indexOf("X") != 17 || iden.indexOf("x") > 0 && iden.indexOf("x") != 17) {
            this.popMsg("注意！身份证信息不合法", "error");
            return;
          }
          if (iden.substring(6, 10) > 2200 || iden.substring(6, 10) < 1900) {
            this.popMsg("注意！身份证信息不合法", "error");
            return;
          }
          if (this.customerAlterVO.cltdob != birth) {
            this.popMsg("注意！出生日期与身份证号码不匹配", "error");
            return;
          }
          let sexNew;
          if (iden.substring(16).substring(0, 1) % 2 == 0) {
            sexNew = "F";
          } else {
            sexNew = "M";
          }
          if (this.customerAlterVO.cltsex != sexNew) {
            this.popMsg("注意！性别与身份证号码不匹配", "error");
            return;
          }
        }
        if (iden.charAt(17) == "x" || iden.charAt(17) == "X") {
          if ("x" != this.GetVerifyBit(iden) && "X" != this.GetVerifyBit(iden)) {
            this.popMsg("身份证校验错误，请检查最后一位！", "error");
            return;
          }

        } else {
          if (iden.charAt(17) != this.GetVerifyBit(iden)) {
            this.popMsg("身份证校验错误，请检查最后一位！", "error");
            return;
          }
        }
      }

      let roleflag_val = this.customerAlterVO.roleflag35; //证件类型
      let ll_asdateup01 = this.customerAlterVO.as_dateup01; //有效期
      let ll_asdateup03 = this.customerAlterVO.as_dateup03; //有效期起始日
      let ll_asFlag = this.customerAlterVO.as_flag; //有效期类型
      let secuityno_val = this.customerAlterVO.secuityno; //获取证件号码
      if (roleflag_val == "B" || roleflag_val == "C") {
        if (roleflag_val == "B") {
          var re = /^\d{18}$/;
          if (!(re.test(iden) && (iden.substring(0, 6) == "810000" || iden.substring(0, 6) == "820000"))) {
            this.popMsg("港澳居民居住证不合法!", "error");
            return;
          }
          // if (this.customerAlterVO.ctrycode != 'HKG' && this.customerAlterVO.ctrycode != 'MAC') {
          //     this.popMsg("港澳居民居住证国籍/地区须为中国香港或者中国澳门", "error");
          //     return;
          // }
        }
        if (roleflag_val == "C") {
          var re = /^\d{18}$/;
          if (!(re.test(iden) && iden.substring(0, 6) == "830000")) {
            this.popMsg("台湾居民居住证不合法!", "error");
            return;
          }
          // if (this.customerAlterVO.ctrycode != 'TWN') {
          //     this.popMsg("台湾居民居住证-国籍/地区必须中国台湾", "error");
          //     return;
          // }
        }

        //证件有效类型以及证件有效日期：必录；且证件有效期类型不能选为“终身”
        if (ll_asdateup03 == null || ll_asdateup03 == "") {
          alert("有效期起始日不能为空");
          return;
        }
        if (ll_asdateup01 == null || ll_asdateup01 == "") {
          alert("有效期截止日不能为空");
          return;
        }
        if (ll_asFlag == null || ll_asFlag == "") {
          alert("证件有效类型不能为空");
          return;
        }
        if (ll_asFlag == "1") {
          alert("所选证件有效类型不能选终身");
          return;
        }
      }
      if (this.customerAlterVO.as_address == null || this.customerAlterVO.as_address == '') {
        this.popMsg("注意！收费地址不能为空", "error");
        return;
      }
      let asAddress = this.customerAlterVO.as_address.trim()
      if (asAddress && asAddress.length > 70) {
        this.popMsg("注意！收费地址长度超出70位了", "error");
        return
      }
      //证件有效期类型为年期，校验日期格式必须为yyyyMMdd
      if (ll_asFlag == '2' && !this.checkValidityDate(ll_asdateup03, "起始日")) {
        return;
      }
      if (ll_asFlag == '2' && !this.checkValidityDate(ll_asdateup01, "截止日")) {
        return;
      }

      // 外国人永久居留身份证
      // ll_asdateup01 - 有效止期, ll_asdateup03 - 有效起期, ll_asFlag - 有效期类型, secuityno_val - 证件号码
      if (roleflag_val == "A") {

        let letterPattern = new RegExp(/^[A-Za-z]+$/);
        let numberPattern = new RegExp(/^[0-9]*$/);

        let errorMsg = "证件号码不符合规则，请重新输入";


        let idcardLen = secuityno_val.length;

        // 证件号码规则校验
        if (idcardLen < 15 || idcardLen > 18 || (idcardLen > 15 && idcardLen < 18)) {
          this.popMsg(errorMsg, "error");
          return
        }

        if (idcardLen === 15) {
          let frontStr = secuityno_val.substring(0, 3);
          let backStr = secuityno_val.substring(3);
          if (!(letterPattern.test(frontStr) && numberPattern.test(backStr))) {
            this.popMsg(errorMsg, "error");
            return
          }
        }

        if (idcardLen === 18) {

          // 出生日期
          let birthday = this.customerAlterVO.cltdob;

          if (!numberPattern.test(secuityno_val)) {
            this.popMsg(errorMsg, "error");
            return
          }

          if (secuityno_val.substring(0, 1) != '9') {
            this.popMsg("注意！首位必须为9", "error");
            return
          }

          if (secuityno_val.substring(6, 14) != birthday) {
            this.popMsg("注意！出生日期与身份证号码不匹配", "error");
            return;
          }

          let sexflag = secuityno_val.substring(16, 17);

          let sex;
          if (Number(sexflag) % 2 == 0) {
            sex = 'F';
          } else {
            sex = 'M'
          }

          if (sex != this.customerAlterVO.cltsex) {
            this.popMsg("注意！性别与身份证号码不匹配", "error");
            return;
          }


        }

        // 证件有效期 > 当天, 并且不允许选择“缺省”/“终身”
        let now = moment().format("YYYYMMDD");
        is_before = moment(ll_asdateup01).isAfter(now);

        if (!is_before || ll_asFlag != '2') {
          this.popMsg("证件类型为“外国人永久居留身份证”时，证件有效期必须大于当前日期且不允许选择'缺省'/'终身'", "error");
          return
        }

        // 证件有效起止期判断
        let customerBirthday = this.customerDetail.birthday;
        let applyAge;

        let startYear = ll_asdateup03.substring(0,4);
        let startMonthAndDay = ll_asdateup03.substring(4);

        let bdYear = customerBirthday.substring(0,4);
        let bdMonthAndDay = customerBirthday.substring(4);

        if (Number(startMonthAndDay) >= Number(bdMonthAndDay)) {
          applyAge = Number(startYear) - Number(bdYear) ;
        } else {
          applyAge = Number(startYear) - Number(bdYear) - 1;
        }

        let errorMsg2 = "您填写的证件有效期不正确，请按证件上的实际有效日期填写！"

        let asdateup01Str = ll_asdateup01.substring(0, 4) + '-' + ll_asdateup01.substring(4, 6) + '-' + ll_asdateup01.substring(6);
        console.log("asdateup01Str:", asdateup01Str);

        /*if (!(ll_asdateup01.substring(4) == "0229" || ll_asdateup03.substring(4) == "0229")) {

          let endMonth = (endDate.getMonth() + 1) < 10 ? '0' + (endDate.getMonth() + 1) : endDate.getMonth() + 1;
          let endDay = endDate.getDate() < 10 ? '0' + endDate.getDate() : endDate.getDate();

          console.log("enddate + 1:", endMonth + ''+ endDay)

          // 月日相等
          let fit = ll_asdateup01.substring(4)  === ll_asdateup03.substring(4)
          // 有效止期月日+1 与 有效起期相等
          let fit2 = endMonth + ''+ endDay == ll_asdateup03.substring(4);

          if (!(fit||fit2)) {
            this.popMsg(errorMsg2, "error");
            return
          }
        }*/
        console.log("永居证客户办证年龄: " + applyAge)
        if(applyAge < 18) {
          let before5y =  this.offsetDate(asdateup01Str, -5, 0, 0);
          let before5y1d = this.offsetDate(asdateup01Str, -5, 0, 1);
          console.log("before5y: " + before5y + ", before5y1d: " + before5y1d);
          if (!(before5y == ll_asdateup03 || before5y1d == ll_asdateup03)) {
            this.popMsg(errorMsg2, "error");
            return
          }
        } else {
          let before10y =  this.offsetDate(asdateup01Str, -10, 0, 0);
          let before10y1d = this.offsetDate(asdateup01Str, -10, 0, 1);
          console.log("before10y: " + before10y + ", before10y1d: " + before10y1d);
          if (!(before10y == ll_asdateup03 || before10y1d == ll_asdateup03)) {
            this.popMsg(errorMsg2, "error");
            return
          }
        }

      }

      let param = {
        customerAlterVO: this.customerAlterVO,
        customerOldInfo: this.customerOldInfo
      }
      this.$store.dispatch('loading/CHNAGE_SUBLOADING', true)
      saveCustomerInfo(param).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.searchParams.nationabdc = '';
          this.templateSelection = '';
          this.customerNo = res.data
          this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
          this.$alert(res.resultMsg, '提示', {
            confirmButtonText: '确定',
            type: 'warning'
          }).then(() => {
            this.$router.push({
              path: "/customer/customerInfoModify", query: {
                clntNo: this.customerNo
              }
            })
          })

        }
      }).catch(err => {
        this.$store.dispatch('loading/CHNAGE_SUBLOADING', false)
      })


    },

    offsetDate(basicDate ,year, month, day) {
      let date = new Date(basicDate);
      date.setFullYear(date.getFullYear() + year);
      date.setMonth(date.getMonth() + month)
      date.setDate(date.getDate() + day);
      let yearStr = date.getFullYear()
      let monthStr = (date.getMonth() + 1) < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1;
      let dayStr = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
      return '' + yearStr + monthStr + dayStr;
    },
    //15位转18位中,计算校验位即最后一位
    GetVerifyBit(id) {
      var result;
      var nNum = eval(id.charAt(0) * 7 + id.charAt(1) * 9 + id.charAt(2) * 10 + id.charAt(3) * 5 + id.charAt(4) * 8 + id.charAt(5) * 4 + id.charAt(6) * 2 + id.charAt(7) * 1 + id.charAt(8) * 6 + id.charAt(9) * 3 + id.charAt(10) * 7 + id.charAt(11) * 9 + id.charAt(12) * 10 + id.charAt(13) * 5 + id.charAt(14) * 8 + id.charAt(15) * 4 + id.charAt(16) * 2);
      nNum = nNum % 11;
      switch (nNum) {
        case 0 :
          result = "1";
          break;
        case 1 :
          result = "0";
          break;
        case 2 :
          result = "X";
          break;
        case 3 :
          result = "9";
          break;
        case 4 :
          result = "8";
          break;
        case 5 :
          result = "7";
          break;
        case 6 :
          result = "6";
          break;
        case 7 :
          result = "5";
          break;
        case 8 :
          result = "4";
          break;
        case 9 :
          result = "3";
          break;
        case 10 :
          result = "2";
          break;
      }
      //document.write(result);
      return result;
    },
    //检查出生日期是否合法
    checkBirthday(val) {
      if (val == '99999999' || val == '00000000') {
        return true;
      }
      if (val.length != 8) {
        this.popMsg("出生日期必须8位", "error");
        return false;
      }
      if (val) {
        let arr = val.split("/");
        let y = '';
        let m = '';
        let d = '';
        if (arr.length > 1) {
          y = arr[0];
          m = arr[1];
          d = arr[2];
        } else {
          y = val.substring(0, 4);
          m = val.substring(4, 6);
          d = val.substring(6, 8);
        }
        let time = y + "-" + m + "-" + d;
        let rep = /^((?!0000)[0-9]{4}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)|(0[13578]|1[02])-31)|([0-9]{2}(0[48]|[2468][048]|[13579][26])|(0[48]|[2468][048]|[13579][26])00)-02-29)$/
        let ret = new RegExp(rep);
        if (!ret.test(time)) {
          this.popMsg("请输入正确出生日期", "error");
          return false;
        }
        return true;

        // if (y > 2200 || y < 1900) {
        //     this.popMsg("请输入正确出生日期", "error");
        //     return;
        // }
        // let reg = /^0?[1-9]$|^1[0-2]$/
        // let repl = new RegExp(reg);
        // if (!repl.test(m)) {
        //     this.popMsg("请输入正确出生日期", "error");
        //     return;
        // }
        // // let reg2 = /^0?[1-9]$|^1[0-9]$|^2[0-9]$|^3[0-1]$/
        // let reg2 = /^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))$/
        // let rep2 = new RegExp(reg2);
        // if (!rep2.test(d)) {
        //     this.popMsg("请输入正确出生日期", "error");
        //     return;
        // }
      }
    },
    //检查身份证号是否合法
    checkIdno(id) {
      let id_length = id.length;
      if (id_length != 15 && id_length != 18) {
        return null;
      }
      if (this.aCity[Number(id.substr(0, 2))] == null) {
        //alert("Error:非法地区");
        return null;
      }
      return "";
    },
    //客户信息重新赋值
    getCustomerAlterVO() {
      let splitNationa = this.customerDetail.nationality.split("-")[0];
      this.customerAlterVO = {
        clntnum: this.customerDetail.customerNo,
        clttype: this.customerDetail.customerType,
        roleflag35: this.customerDetail.idType,
        secuityno: this.customerDetail.idNo,
        surname: this.customerDetail.customerName,
        as_flag: this.customerDetail.validityType,
        as_dateup01: this.customerDetail.validityDate,
        as_dateup03: this.customerDetail.startValidityDate,
        cltdob: this.customerDetail.birthday,
        cltsex: this.customerDetail.sex,
        marryd: this.customerDetail.marryd,
        ctrycode: splitNationa,
        cltphone01: this.customerDetail.mobilePhoneOne,
        cltphone02: this.customerDetail.mobilePhoneTwo,
        rmblphone: this.customerDetail.fixedTelephone,
        faxno: this.customerDetail.faxno,
        rdidtelno: this.customerDetail.rdidtelno,
        cltpcode: this.customerDetail.cltpcode,
        risklvl: this.customerDetail.riskLevel,
        email: this.customerDetail.email,
        // flag02: this.customerDetail.shippingMethod,
        flag02: this.customerDetail.shippingMethod,
        // customerDetail.professionalLevel
        flag03: this.customerDetail.unitType,
        rkscore: this.customerDetail.customerRiskValue,
        reason: this.customerDetail.reason,
        occpcode: this.customerDetail.occpCode,
        as_address: this.customerDetail.postalAddress,
        cltind: this.customerDetail.cltind,
      }

    },
    //客户性质为C公司,并且单位性质为C,D,F,G时，进行特殊处理
    checkCustomerType() {
      let flag03 = this.customerAlterVO.flag03;
      if (this.customerAlterVO.clttype == "C" && (flag03 == "C" || flag03 == "D"
          || flag03 == "E" || flag03 == "F" || flag03 == "G")) {
        let params = {
          "clntnum": this.customerNo,
          "type": "trust",
        }
        let that = this;
        trustManage(params).then(res => {
          this.$store.dispatch('loading/CHANGE_LOADING', false)
          let msg = "请在”信托信息管理”输入客户号:" + that.customerNo + "的法定代表人/主要负责人信息";
          if (res.resultCode == constant.SUCCESS && res.data) {
            if (res.data.cltrl) {
              //如果有信托信息，则继续保存
              that.re_saveCustomer();
            } else {
              this.$alert(msg, '', {
                confirmButtonText: '确定',
                callback: action => {
                  if (that.update == 'N') {
                    that.re_saveCustomer();
                  }
                }
              });
            }
          } else {
            this.$alert(msg, '', {
              confirmButtonText: '确定',
              callback: action => {
                if (that.update == 'N') {
                  that.re_saveCustomer();
                }
              }
            });
          }
        }).catch(err => {
          this.$store.dispatch('loading/CHANGE_LOADING', false);
          this.$emit('checkData', false)
        })
      } else {
        this.re_saveCustomer();
      }
    },
    //个人税收居民身份声明
    skipIndividualTax() {
      if (this.customerNo) {
        this.$router.push({
          path: "/customer/customerTaxFileUpdate", query: {
            clntnum: this.customerNo
          }
        })
      } else {
        this.popMsg("请先保存客户基本信息", "error");
      }

    },
    //查看历史修改记录
    skipHistoryDialog() {
      this.historyDialog = true;
      let param = {
        "clntnum": this.customerDetail.customerNo,
        "pageSize": this.paginations2.pageSize,
        "pageNumber": this.paginations2.pageIndex
      }
      this.$store.dispatch('loading/CHANGE_LOADING', true)
      getHistoryRecord(param).then(res => {
        this.$store.dispatch('loading/CHANGE_LOADING', false)
        if (res.resultCode == constant.SUCCESS && res.data.list.length > 0) {
          this.historyTableData = res.data.list;
          this.historyTableData.map(item => {
            if (item.itemName == 'as_flag') {
              if (item.oldVal == 1) {
                item.oldVal = '终身';
              }
              if (item.oldVal == 2) {
                item.oldVal = '年期';
              }
              if (item.oldVal == 3) {
                item.oldVal = '缺省';
              }
              if (item.newVal == 1) {
                item.newVal = '终身';
              }
              if (item.newVal == 2) {
                item.newVal = '年期';
              }
              if (item.newVal == 3) {
                item.newVal = '缺省';
              }
            }
          })
          this.paginations2.total = res.data.total;
        }
        this.$emit('checkData', this.historyTableData.length > 0 ? true : false)
      }).catch(err => {
        this.$store.dispatch('loading/CHANGE_LOADING', false);
        this.$emit('checkData', false)
      })

    },
    //信托信息管理
    skipTrustManageDialog() {
      this.trustManageDialog = true;
      let params = {
        "clntnum": this.customerNo,
        "type": "trust",
      }
      this.$store.dispatch('loading/CHANGE_LOADING', true)
      trustManage(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.$store.dispatch('loading/CHANGE_LOADING', false)
          if (res.data.cltrp) {
            this.cltrp = res.data.cltrp;
          } else {
            this.cltrp = {};
          }
          if (res.data.cltrl) {
            this.cltrl = res.data.cltrl;
          } else {
            this.cltrl = {};
          }
        }
        this.$emit('checkData', this.tableData.length > 0 ? true : false)
      }).catch(err => {
        this.$store.dispatch('loading/CHANGE_LOADING', false);
        this.$emit('checkData', false)
      })

    },
    //股东/合伙人信息管理
    skipCopartnerManageDialog() {
      if (this.customerNo == undefined || this.customerNo == null || this.customerNo == '') {
        this.popMsg("客户号为空，请先保存信息", "error");
        return;
      }
      this.addCon = 1;
      this.copartnerManageDialog = true;
      let params = {
        "clntnum": this.customerNo,
        "type": "copartner",
      }
      this.$store.dispatch('loading/CHANGE_LOADING', true)
      trustManage(params).then(res => {
        if (res.resultCode == constant.SUCCESS && res.data.copartner) {
          this.$store.dispatch('loading/CHANGE_LOADING', false);
          if (res.data.copartner.length > 0) {
            this.copartner = res.data.copartner;
            this.isSave = true;
          } else {
            this.copartner = [{}];
          }
          this.popMsg("获取股东/合伙人信息成功", "success");
        }
      }).catch(err => {
        this.$store.dispatch('loading/CHANGE_LOADING', false);
        this.$emit('checkData', false)
      })
    },
    //股权/表决权信息管理
    skipStockDialog() {
      if (this.customerNo == undefined || this.customerNo == null || this.customerNo == '') {
        this.popMsg("客户号为空，请先保存信息", "error");
        return;
      }
      this.addSto = 1;
      this.stockDialog = true;
      let params = {
        "clntnum": this.customerNo,
        "type": "stock",
      }
      this.$store.dispatch('loading/CHANGE_LOADING', true)
      trustManage(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.$store.dispatch('loading/CHANGE_LOADING', false);
          if (res.data.shcltr) {
            this.shcltr = res.data.shcltr;
          } else {
            this.shcltr = {};
          }
          if (res.data.shcltrList.length > 0) {
            this.shcltrList = res.data.shcltrList;
          } else {
            this.shcltrList = [{}];
          }
          this.popMsg("获取股权/表决权信息成功", "success");
        }
      }).catch(err => {
        this.$store.dispatch('loading/CHANGE_LOADING', false);
        this.$emit('checkData', false)
      })
    },
    //国籍查询
    skipAsIdDialogVisible() {
      this.asIdDialogVisible = true;
      let params = {
        "nationabdc": this.searchParams.nationabdc,
        "pageSize": this.paginations3.pageSize,
        "pageNumber": this.paginations3.pageIndex,
      }
      getNationPageList(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          if (res.data && res.data.list) {
            this.asIdTableData = res.data.list;
            this.paginations3.total = res.data.total;
            this.popMsg(res.resultMsg, "success");
          } else {
            this.asIdTableData = [];
            this.paginations3.total = 0;
            this.popMsg("无符合条件资料", "error");
          }
        }
      }).catch(err => {
        this.$emit('checkData', false)
      })
    },
    //信托信息黑名单检测
    testBlacklist() {
      if (this.cltrl.lsurname == "" || this.cltrl.lsurname == null) {
        this.popMsg("法定代表/主要负责人姓名不能为空", "error");
        return false;
      }
      if (this.cltrl.secuityno == "" || this.cltrl.secuityno == null) {
        this.popMsg("法定代表/主要负责人姓名不能为空", "error");
        return false;
      }
      let param = {
        "map": [{
          "lsurname": this.cltrl.lsurname,
          "secuityno": this.cltrl.secuityno,
        }]
      }
      let that = this;
      checkBlacklistInfo(param).then(res => {
        if (res.resultCode == constant.SUCCESS && res.data.length > 0) {
          for (let j = 0; j < res.data.length; j++) {
            if (res.data[j]['BLACKLISTFLAG'] == 'Y') {
              this.popMsg("法人" + res.data[j]['LSURNAME'] + "属于黑名单", "success");
              this.cltrl.blacklist = 'Y';
            } else {
              this.popMsg("法人" + res.data[j]['LSURNAME'] + "不属于黑名单", "success");
              this.cltrl.blacklist = 'N';
            }
          }

        }
      }).catch(err => {
        that.popMsg(err, "error");
      })
    },

    //保存信托信息管理
    saveTrustManage() {
      let cltrpFlag = false;
      let cltTimeNew = this.getCltDate();
      if (this.cltrp.lsurname) {
        cltrpFlag = true;
      }
      if (this.cltrp.cltind) {
        cltrpFlag = true;
      }
      if (this.cltrp.secuityno) {
        cltrpFlag = true;
      }
      if (this.cltrp.rinternet) {
        cltrpFlag = true;
      }
      if (this.cltrp.cltdod) {
        cltrpFlag = true;
      }
      if (this.cltrp.cmntdesc) {
        cltrpFlag = true;
      }
      if (cltrpFlag) {
        if (this.cltrp.lsurname == null || this.cltrp.lsurname.length == 0) {
          this.popMsg("注意:请输入单位名称", "error");
          return;
        }
        if (this.cltrp.lsurname && this.cltrp.lsurname.length < 2) {
          this.popMsg("注意:信托投保人单位名称长度需大于2", "error");
          return;
        }
        if (this.cltrp.cltind == null || this.cltrp.cltind.length == 0) {
          this.popMsg("注意:信托投保人证件类型不能为空", "error");
          return;
        }
        if (this.cltrp.secuityno == null || this.cltrp.secuityno.length == 0) {
          this.popMsg("注意:信托投保人证件号码不能为空", "error");
          return;
        }
        if (this.cltrp.cltdod == null || this.cltrp.cltdod.length == 0) {
          this.popMsg("注意:信托投保人证件有效期截止日期不能为空", "error");
          return;
        }
        if (this.cltrp.cmntdesc == null || this.cltrp.cmntdesc.length == 0) {
          this.popMsg("注意:信托投保人收费地址不能为空", "error");
          return;
        }

        if (this.cltrp.cltdod < cltTimeNew) {
          this.popMsg("注意:信托投保人证件有效期已过期", "error");
          return;
        }
      }
      if (this.cltrl.lsurname == null || this.cltrl.lsurname.length == 0) {
        this.popMsg("注意:法定代表人/主要负责人姓名不能为空", "error");
        return;
      }
      if (this.cltrl.cltind == null || this.cltrl.cltind.length == 0) {
        this.popMsg("注意:法定代表人证件类型不能为空", "error");
        return;
      }
      if (this.cltrl.secuityno == null || this.cltrl.secuityno.length == 0) {
        this.popMsg("注意:法定代表人证件号码不能为空", "error");
        return;
      }
      if (this.cltrl.cltind == '1') {
        if (this.cltrl.secuityno.length < 18) {
          this.popMsg("注意:法定代表人身份证必须为18位", "error");
          return;
        }
      }
      if (this.cltrl.role == null || this.cltrl.role.length == 0) {
        this.popMsg("注意:法定代表人职位不能为空", "error");
        return;
      }
      if (this.cltrl.rinternet == null || this.cltrl.rinternet.length == 0) {
        this.popMsg("注意:法定代表人有效期类型不能为空", "error");
        return;
      }
      if (this.cltrl.cltdod == null || this.cltrl.cltdod.length == 0) {
        this.popMsg("注意:法定代表人证件有效期截止日期不能为空", "error");
        return;
      }
      if (this.cltrl.cltdod < cltTimeNew) {
        this.popMsg("注意:法定代表人证件有效期已过期", "error");
        return;
      }
      let params = {
        cltrl: this.cltrl,
        cltrp: this.cltrp,
        clntnum: this.customerDetail.customerNo,
      }
      let that = this;
      saveTrustManageInfo(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.popMsg(res.resultMsg, "success");
          this.trustManageDialog = false;
        }
      }).catch(err => {
        that.popMsg(err, "error");
      })
    },
    //股东、合伙人信息保存
    saveCopartner() {
      //校验
      if (!this.checkCopartner()) {
        return;
      }
      let params = {
        copartner: this.copartner,
        clntnum: this.customerDetail.customerNo,
      }
      let that = this;
      saveCopartnerManage(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.isSave = true;
          this.popMsg("保存成功", "success");
          this.copartnerManageDialog = false;
        }
      }).catch(err => {
        that.popMsg(err, "error");
      })

    },
    checkCopartner() {
      let sum_paypct01 = 0
      for (let i = 0; i < this.copartner.length; i++) {
        let paypct01 = Number(this.copartner[i]['paypct01']);
        sum_paypct01 += paypct01;
        if (sum_paypct01 > 100) {
          this.popMsg("所有人合伙权益比例之和不能大于100%!", "error");
          return false;
        }
        if (paypct01 == null || paypct01 == "") {
          this.popMsg("注意:所有人" + [i + 1] + "合伙权益比例不能为空！", "error");
          return false;
        }
        if (paypct01 < 25 || paypct01 > 100) {
          this.popMsg("注意:所有人" + [i + 1] + "合伙权益比例应该在25%到100%之间！", "error");
          return false;
        }
        let lsurname_s = this.copartner[i]['lsurname'];
        if (lsurname_s == null || lsurname_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "姓名不能为空！", "error");
          return false;
        }
        if (lsurname_s && lsurname_s.length < 2) {
          this.popMsg("注意:所有人" + [i + 1] + "姓名长度需大于2！", "error");
          return false;
        }

        let cltind_s = this.copartner[i]['cltind'];
        if (cltind_s == null || cltind_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "证件类型不能为空！", "error");
          return false;
        }
        let secuityno_s = this.copartner[i]['secuityno'];
        if (secuityno_s == null || secuityno_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "证件号码不能为空！", "error");
          return false;
        }
        if (cltind_s == "1") {
          if (secuityno_s.length != 18) {
            this.popMsg("注意:所有人" + [i + 1] + "身份证必须为18位！", "error");
            return false;
          }
        }
        let natlty_s = this.copartner[i]['natlty'];
        if (natlty_s == null || natlty_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "国籍不能为空！", "error");
          return false;
        }
        let rinternet_s = this.copartner[i]['rinternet'];
        if (rinternet_s == null || rinternet_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "有效期类型不能为空！", "error");
          return false;
        }
        if (rinternet_s != "1") {
          let cltdod_s = this.copartner[i]['cltdod'];
          if (cltdod_s == "" || cltdod_s == null) {
            this.popMsg("注意:所有人" + [i + 1] + "证件有效期截止日不能为空！", "error");
            return false;
          }
          let cltTimeNew = this.getCltDate();
          if (cltdod_s < cltTimeNew) {
            this.popMsg("注意:所有人" + [i + 1] + "证件有效期已过期！", "error");
            return false;
          }
        } else {
          this.copartner[i]['cltdod'] = "99999999";//当有效期类型为终身时，给有效期截止日赋值99999999
        }
        let cmntdesc_s = this.copartner[i]['cmntdesc'];
        if (cmntdesc_s == null || cmntdesc_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "联系地址不能为空！", "error");
          return false;
        }
      }
      return true;
    },
    //股权代表信息保存
    saveStock() {
      //校验
      if (!this.checkStock()) {
        return;
      }
      let params = {
        shcltr: this.shcltr,
        shcltrList: this.shcltrList,
        clntnum: this.customerDetail.customerNo,
      }
      let that = this;
      saveStockInfo(params).then(res => {
        if (res.resultCode == constant.SUCCESS) {
          this.isSaveSto = true;
          this.popMsg(res.resultMsg, "success");
          this.stockDialog = false;
        }
      }).catch(err => {
        that.popMsg(err, "error");
      })

    },
    //股权代表信息保存校验
    checkStock() {
      let oinputCheck = false;
      let cltTimeNew = this.getCltDate();
      if (this.shcltr.lsurname) {
        oinputCheck = true;
      }
      if (this.shcltr.cltind) {
        oinputCheck = true;
      }
      if (this.shcltr.secuityno) {
        oinputCheck = true;
      }
      if (this.shcltr.rinternet) {
        oinputCheck = true;
      }
      if (this.shcltr.cltdod) {
        oinputCheck = true;
      }
      if (this.shcltr.blacklist) {
        oinputCheck = true;
      }
      if (this.shcltr.cmntdesc) {
        oinputCheck = true;
      }
      if (oinputCheck) {
        if (this.shcltr.lsurname == null || this.shcltr.lsurname == "") {
          this.popMsg("公司或企业所有人姓名不能为空！", "error");
          return false;
        }
        if (this.shcltr.lsurname && this.shcltr.lsurname.length < 2) {
          this.popMsg("公司或企业所有人姓名长度需大于2！", "error");
          return false;
        }
        if (this.shcltr.cltind == null || this.shcltr.cltind == "") {
          this.popMsg("公司或企业所有人证件类型不能为空！", "error");
          return false;
        }
        if (this.shcltr.secuityno == null || this.shcltr.secuityno == "") {
          this.popMsg("公司或企业所有人证件号码不能为空！", "error");
          return false;
        }
        let idNo = this.shcltr.secuityno.trim();
        if (this.shcltr.cltind == "1") {
          if (idNo.length != 18) {
            this.popMsg("公司或企业所有人身份证必须为18位！", "error");
            return false;
          }
        }
        if (this.shcltr.natlty == null || this.shcltr.natlty == "") {
          this.popMsg("公司或企业所有人国籍不能为空！", "error");
          return false;
        }
        if (this.shcltr.rinternet == null || this.shcltr.rinternet == "") {
          this.popMsg("公司或企业所有人有效期类型不能为空！", "error");
          return false;
        }
        if (this.shcltr.rinternet != "1") {
          if (this.shcltr.cltdod == "" || this.shcltr.cltdod == null) {
            this.popMsg("公司或企业所有人证件有效期截止日不能为空！", "error");
            return false;
          }

          if (this.shcltr.cltdod < cltTimeNew) {
            this.popMsg("公司或企业所有人证件有效期已过期！", "error");
            return false;
          }
        } else {
          this.shcltr.cltdod = "99999999";//当有效期类型为终身时，给有效期截止日赋值99999999
        }
        if (this.shcltr.cmntdesc == null || this.shcltr.cmntdesc == "") {
          this.popMsg("公司或企业所有人联系地址不能为空！", "error");
          return false;
        }
      }

      let sum_paypct02 = 0;
      let sum_paypct03 = 0;
      for (let i = 0; i < this.shcltrList.length; i++) {
        let paypct02 = Number(this.shcltrList[i]['paypct02']);
        sum_paypct02 += paypct02;
        let paypct03 = Number(this.shcltrList[i]['paypct03']);
        sum_paypct03 += paypct03;
        if (sum_paypct02 > 100) {
          this.popMsg("股权或者表决权所有人持股比例之和不能大于100%!", "error");
          return false;
        }
        if (sum_paypct03 > 100) {
          this.popMsg("股权或者表决权所有人表决权比例之和不能大于100%!", "error");
          return false;
        }
        if (paypct02 == null || paypct02 == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "持股比例不能为空！", "error");
          return false;
        }
        if (paypct03 == null || paypct03 == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "表决权比例不能为空！", "error");
          return false;
        }

        if (paypct02 < 25 || paypct02 > 100) {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "持股比例应该在25%到100%之间！", "error");
          return false;
        }
        if (paypct03 < 25 || paypct03 > 100) {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "表决权比例应该在25%到100%之间！", "error");
          return false;
        }

        let lsurname_s = this.shcltrList[i]['lsurname'];
        if (lsurname_s == null || lsurname_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "姓名不能为空！", "error");
          return false;
        }
        if (lsurname_s && lsurname_s.length < 2) {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "姓名长度需大于2！", "error");
          return false;
        }

        let cltind_s = this.shcltrList[i]['cltind'];
        if (cltind_s == null || cltind_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "证件类型不能为空！", "error");
          return false;
        }
        let secuityno_s = this.shcltrList[i]['secuityno'];
        if (secuityno_s == null || secuityno_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "证件号码不能为空！", "error");
          return false;
        }
        if (cltind_s == "1") {
          if (secuityno_s.trim().length != 18) {
            this.popMsg("股权或者表决权所有人" + [i + 1] + "身份证必须为18位！", "error");
            return false;
          }
        }
        let natlty_s = this.shcltrList[i]['natlty'];
        if (natlty_s == null || natlty_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "国籍不能为空！", "error");
          return false;
        }
        let rinternet_s = this.shcltrList[i]['rinternet'];
        if (rinternet_s == null || rinternet_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "有效期类型不能为空！", "error");
          return false;
        }
        if (rinternet_s != "1") {
          let cltdod_s = this.shcltrList[i]['cltdod'];
          if (cltdod_s == "" || cltdod_s == null) {
            this.popMsg("股权或者表决权所有人" + [i + 1] + "证件有效期截止日不能为空！", "error");
            return false;
          }
          let cltTimeNew = this.getCltDate();
          if (cltdod_s < cltTimeNew) {
            this.popMsg("股权或者表决权所有人" + [i + 1] + "证件有效期已过期！", "error");
            return false;
          }
        } else {
          this.shcltrList[i]['cltdod'] = "99999999";//当有效期类型为终身时，给有效期截止日赋值99999999
        }
        let cmntdesc_s = this.shcltrList[i]['cmntdesc'];
        if (cmntdesc_s == null || cmntdesc_s == "") {
          this.popMsg("股权或者表决权所有人" + [i + 1] + "联系地址不能为空！", "error");
          return false;
        }
      }
      return true;
    },
    //股东合伙人信息黑名单检测
    testBlacklist1() {
      for (let i = 0; i < this.copartner.length; i++) {
        let lsurname_s = this.copartner[i]['lsurname'];
        let secuityno_s = this.copartner[i]['secuityno'];
        if (lsurname_s == null || lsurname_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "姓名不能为空！", "error");
          return;
        }
        if (secuityno_s == null || secuityno_s == "") {
          this.popMsg("注意:所有人" + [i + 1] + "证件号码不能为空！", "error");
          // blacklistFlag = false;
          return;
        }
      }
      let param = {
        "map": this.copartner,
      }
      let that = this;
      checkBlacklistInfo(param).then(res => {
        let isBlack = '';
        let isNotBlack = '';
        if (res.resultCode == constant.SUCCESS && res.data.length > 0) {
          for (let j = 0; j < res.data.length; j++) {
            if (res.data[j]['BLACKLISTFLAG'] == 'Y') {
              isBlack = isBlack + res.data[j]['LSURNAME'] + ",";
              this.copartner[j]['blacklist'] = 'Y';
            } else {
              isNotBlack = isNotBlack + res.data[j]['LSURNAME'] + ",";
              this.copartner[j]['blacklist'] = 'N';
            }
          }
          if (isBlack != '') {
            this.popMsg("所有人" + isBlack + "属于黑名单", "success");
          }
          if (isNotBlack != '') {
            this.popMsg("所有人" + isNotBlack + "不属于黑名单", "success");
          }

        }
      }).catch(err => {
        that.popMsg(err, "error");
      })
    },
    // 实名查验
    testBlacklist3() {
      this.checkManageDialog = true;
    },
    //股权/表决权黑名单检测
    testBlacklist2() {
      if (this.shcltr.lsurname == null || this.shcltr.lsurname == "") {
        this.popMsg("注意:其他实际控制公司或企业所有人姓名不能为空！", "error");
        return;
      }
      if (this.shcltr.secuityno == null || this.shcltr.secuityno == "") {
        this.popMsg("注意:其他实际控制公司或企业所有人证件号码不能为空！", "error");
        return;
      }
      for (let i = 0; i < this.shcltrList.length; i++) {
        let lsurname_s = this.shcltrList[i]['lsurname'];
        let secuityno_s = this.shcltrList[i]['secuityno'];
        if (lsurname_s == null || lsurname_s == "") {
          this.popMsg("注意:股权或表决权者所有人" + [i + 1] + "姓名不能为空！", "error");
          return;
        }
        if (secuityno_s == null || secuityno_s == "") {
          this.popMsg("注意:股权或表决权者所有人" + [i + 1] + "证件号码不能为空！", "error");
          return;
        }
      }
      let paramList = [];
      paramList.push(this.shcltr);
      for (let k = 0; k < this.shcltrList.length; k++) {
        paramList.push(this.shcltrList[k])
      }
      let param = {
        "map": paramList,
      }
      let that = this;
      checkBlacklistInfo(param).then(res => {
        let isBlack = '';
        let isNotBlack = '';
        if (res.resultCode == constant.SUCCESS && res.data.length > 0) {
          for (let j = 0; j < res.data.length; j++) {
            if (res.data[j]['BLACKLISTFLAG'] == 'Y') {
              if (res.data[j]['LSURNAME'] == this.shcltr.lsurname) {
                this.shcltr['blacklist'] = 'Y';
              } else {
                // this.shcltrList[j]['blacklist'] = 'Y';
              }
              isBlack = isBlack + res.data[j]['LSURNAME'] + ",";
            } else {
              if (res.data[j]['LSURNAME'] == this.shcltr.lsurname) {
                this.shcltr['blacklist'] = 'N';
              } else {
                // this.shcltrList[j]['blacklist'] = 'N';
              }
              isNotBlack = isNotBlack + res.data[j]['LSURNAME'] + ",";
            }
          }
          if (isBlack != '') {
            this.popMsg("所有人" + isBlack + "属于黑名单", "success");
          }
          if (isNotBlack != '') {
            this.popMsg("所有人" + isNotBlack + "不属于黑名单", "success");
          }

        }
      }).catch(err => {
        that.popMsg(err, "error");
      })
    },
    getCltDate() {
      let date = new Date();
      let year = date.getFullYear(); //年
      let month = date.getMonth() + 1; //月份
      let day = date.getDate(); //日期
      if (month < 10) {
        month = "0" + month
      }
      let cltTime = year + "" + month + "" + day;
      return cltTime;
    },
    checkClntnum(row) {
      this.customerDetail.clntnum = row.clntnum;
      this.customerDetail.birthday = row.as_cltdob;
      this.customerDetail.postalAddress = row.cltaddr01 + row.cltaddr02 + row.cltaddr03 + row.cltaddr04 + row.cltaddr05;
      this.customerDetail.idType = row.cltind;
      this.customerDetail.mobileTelephone = row.cltphone01;
      this.customerDetail.mobilePhoneTwo = row.cltphone02;
      this.customerDetail.sex = row.cltsex;
      this.customerDetail.customerType = row.clttype;
      this.customerDetail.nationality = row.ctrycode;
      this.customerDetail.faxno = row.faxno;
      this.customerDetail.marryd = row.marryd;
      this.customerDetail.idNo = row.secuityno;
      this.customerDetail.customerName = row.surname;
      console.log(this.customerDetail);
      this.isCheckVisible = false;
    },
    //增加合伙人
    addCopartner() {
      let sum_paypct01 = 0
      for (let i = 0; i < this.copartner.length; i++) {
        let paypct01 = Number(this.copartner[i]['paypct01']);
        sum_paypct01 += paypct01;
        if (sum_paypct01 > 75) {
          this.popMsg("所有人合伙权益比例之和大于75%，不能再增加所有人!", "error");
          return false;
        }
      }
      if (!this.isSave) {
        this.popMsg("请先保存当前所有人信息，再进行增加操作！", "error");
        return;
      } else {
        this.copartner.push({});
      }
      this.isSave = false;
      this.addCon++;
    },
    //增加股权/表决权信息管理
    addStock() {
      let sum_paypct02 = 0
      let sum_paypct03 = 0
      for (let i = 0; i < this.shcltrList.length; i++) {
        let paypct02 = Number(this.shcltrList[i]['paypct02']);
        let paypct03 = Number(this.shcltrList[i]['paypct03']);
        sum_paypct02 += paypct02;
        sum_paypct03 += paypct03;
        if (sum_paypct02 > 75) {
          this.popMsg("所有人持股比例之和大于75%，不能再增加所有人!", "error");
          return false;
        }
        if (sum_paypct03 > 75) {
          this.popMsg("所有人表决权比例之和大于75%，不能再增加所有人!", "error");
          return false;
        }
      }
      if (this.addSto == 1) {
        this.shcltrList.push({});
      } else if (this.isSaveSto) {
        this.shcltrList.push({});
      } else {
        this.popMsg("请先保存当前所有人信息，再进行增加操作！", "error");
      }
      this.isSaveSto = false;
      this.addSto++;

    },
    getCardInfo(iden) {
      let val = iden.length;

      // 外国人永久居留身份证需求
      if (this.customerDetail.idType == 'A' && val == 18) {
        let outlandSex = iden.substring(16, 17);
        if (outlandSex % 2 == 0) {
          this.customerDetail.sex = 'F'
        } else {
          this.customerDetail.sex = 'M'
        }
      }


      if (this.customerDetail.idType != '1') {
        return;
      }
      if (val != '18' && val != '15') {
        this.popMsg("注意:身份证不合法", "error");
        return;
      }

      let sex = null;
      let year = '';
      let month = '';
      let day = '';
      let birthday = '';

      if (val == 18) {
        sex = iden.substring(16, 17);
        year = iden.substring(6, 10);
        month = iden.substring(10, 12);
        day = iden.substring(12, 14);
        birthday = year + month + day;
      }
      if (val == 15) {
        sex = iden.substring(13, 14);
        year = iden.substring(6, 8);
        month = iden.substring(8, 10);
        day = iden.substring(10, 12);
        birthday = "19" + year + month + day;
      }

      if (sex % 2 == 0) {
        this.customerDetail.sex = 'F'
      } else {
        this.customerDetail.sex = 'M'
      }
      this.customerDetail.birthday = birthday;

    },
    // 每页多少条切换(检查重客)
    handleSizeChange1(pageSize) {
      this.paginations1.pageSize = pageSize;
      this.checkCus();
    },
    //每页多少条切换(历史记录)
    handleSizeChange2(pageSize) {
      this.paginations2.pageSize = pageSize;
      this.skipHistoryDialog();
    },
    //每页多少条切换(国籍列表)
    handleSizeChange3(pageSize) {
      this.paginations3.pageSize = pageSize;
      this.skipAsIdDialogVisible();
    },
    // 上下分页
    handleCurrentChange1(page) {
      this.paginations1.pageIndex = page;
      this.checkCus();
    },
    handleCurrentChange2(page) {
      this.paginations2.pageIndex = page;
      this.skipHistoryDialog();
    },
    handleCurrentChange3(page) {
      this.paginations3.pageIndex = page;
      this.skipAsIdDialogVisible();
    },
    popMsg(message, type) {
      this.$message({
        message: message,
        type: type
      });
    },
    backCustomerList() {
      this.$router.go(-1);//返回上一层
    },
    backDetail() {
      this.trustManageDialog = false;
    },
    modifyType(val) {
      if (val.type == '1') {
        return "新增"
      }
      if (val.type == '2') {
        return "修改"
      }
    },
    isvalidflag(val) {
      if (val.validflag == '1') {
        return "有效"
      }
      if (val.validflag == '2') {
        return "无效"
      }
    },
    isclttype(val) {
      if (val.clttype == 'C') {
        return "公司"
      }
      if (val.clttype == 'P') {
        return "个人"
      }
    },
    iscltsex(val) {
      if (val.cltsex == 'F') {
        return "女"
      }
      if (val.cltsex == 'M') {
        return "男"
      }
      if (val.cltsex == 'U') {
        return "不明"
      }
    },
    ismarryd(val) {
      if (val.marryd == 'S') {
        return "单身"
      }
      if (val.marryd == 'M') {
        return "已婚"
      }
      if (val.marryd == 'D') {
        return "离婚"
      }
      if (val.marryd == 'N') {
        return "未知"
      }
      if (val.marryd == 'W') {
        return "鳏寡"
      }
    },
    skipcheckType() {
      this.customerDetail.nationality = this.nationality;
      if (this.nationality != null && this.nationality != "") {
        this.asIdDialogVisible = false;
      } else {
        this.popMsg("注意:请选择国籍信息", "error");
      }
    },
    checkNation(row) {
      this.nationality = row.nationab + "-" + row.nationabcd;
      this.templateSelection = this.asIdTableData.indexOf(row);
      this.templateRadio = row.nationabcd;

      // if (this.checkType) {
      //     this.customerDetail.nationality = this.nationality;
      // }else{

      // }
      this.nationab = row.nationab;
    },
    isitemName(val) {
      if (val.itemName == 'roleflag35') {
        return "证件类型"
      }
      if (val.itemName == 'secuityno') {
        return "证件号码"
      }
      if (val.itemName == 'surname') {
        return "姓名"
      }
      if (val.itemName == 'as_flag') {
        return "有效期类型"
      }
      if (val.itemName == 'as_dateup01') {
        return "有效期截止日"
      }
      if (val.itemName == 'as_dateup03') {
        return "有效期起始日"
      }
      if (val.itemName == 'cltphone01') {
        return "电话1"
      }
      if (val.itemName == 'cltphone02') {
        return "电话2"
      }
      if (val.itemName == 'rmblphone') {
        return "移动电话"
      }
      if (val.itemName == 'as_address') {
        return "通讯地址"
      }
    },
    checkLock() {
      if (!this.checkModify) {
        for (const argumentsKey in this.lockMap) {
          this.lockMap[argumentsKey] = true;
        }
        return;
      }
      // 查是否有其它保单正在使用此客户号
      if (this.customerDetail.asClrr == "Y") {
        this.lockMap.customerType = true; //客户类型下拉框锁定
        this.lockMap.idNo = true;
        this.lockMap.customerName = true;
      }
      //如果有效期类别为年期-2，有效期截止日as_dateup01栏位可编辑。
      if (this.customerDetail.validityType == '2') {
        this.lockMap.validityDate = false;
        this.lockMap.startValidityDate = false;
      }
      this.lockMap.customerType = true;
      if (this.customerDetail.customerType == "P") {		//个人
        if (this.customerDetail.sex == '' || this.customerDetail.asClrr == 'Y') {
          this.lockMap.sex = false;
        } else {
          // this.lockMap.sexReadOnly = true;
        }
        if (this.customerDetail.marryd == '' || this.customerDetail.asClrr == 'Y') {
          this.lockMap.marryd = false;
        } else {
          this.lockMap.marrydReadOnly = true;
        }
        this.lockMap.idType = false;
        this.lockMap.marryd = false;
      }
      if (this.customerDetail.cltind == "D") {//如果是D
        for (const argumentsKey in this.lockMap) {
          this.lockMap[argumentsKey] = true;
        }
        this.lockMap.cltpcode = false;
        this.lockMap.postalAddress = false;
      } else if (this.customerDetail.cltind == "C" || this.customerDetail.cltind == "L" || this.customerDetail.cltind == "A") { //主客(C)、连客（L或A）
        //如果有其它保单正在使用此客户号，邮箱和手机号不能修改
        if (this.customerDetail.asClrr == "Y") {
          //手机号如果为空，可修改
          if (this.customerDetail.fixedTelephone == "") {
            this.lockMap.fixedTelephone = false;
          }
          //其它电话如果为空，可修改
          if (this.customerDetail.rdidtelno == "") {
            this.lockMap.rdidtelno = false;
          } else {
            this.lockMap.rdidtelno = true;
          }
          this.lockMap.idNo = false;
          this.lockMap.customerName = false;
          this.lockMap.validityType = false;
          this.lockMap.nationality = false;
          this.lockMap.mobilePhoneOne = false;
          this.lockMap.mobilePhoneTwo = false;
          this.lockMap.faxno = false;
          this.lockMap.cltpcode = false;
          this.lockMap.postalAddress = false;
        } else {
          if (this.customerDetail.asClrr != "" && this.customerDetail.asClrr != undefined && this.customerDetail.asClrr != null) {
            this.lockMap.idNo = false;
            this.lockMap.customerName = false;
            this.lockMap.validityType = false;
            this.lockMap.nationality = false;
            this.lockMap.mobilePhoneOne = false;
            this.lockMap.mobilePhoneTwo = false;
            this.lockMap.faxno = false;
            this.lockMap.cltpcode = false;
            this.lockMap.postalAddress = false;
            this.lockMap.fixedTelephone = false;
            this.lockMap.rdidtelno = false;
          } else {
            this.lockMap.idNo = false;
            this.lockMap.customerName = false;
            this.lockMap.validityType = false;
            this.lockMap.nationality = false;
            this.lockMap.mobilePhoneOne = false;
            this.lockMap.mobilePhoneTwo = false;
            this.lockMap.faxno = false;
            this.lockMap.cltpcode = false;
            this.lockMap.postalAddress = false;
            this.lockMap.fixedTelephone = false;
            this.lockMap.rdidtelno = false;
            this.lockMap.idType = false;
          }
        }
      }
      this.lockMap.birthday = false;
      this.lockMap.sex = false;
      this.lockMap.fixedTelephone = false;
      if (this.customerDetail.customerType == "C") {
        this.lockMap.idNo = true;
        this.lockMap.idType = true;
      }
    },
    //检测权限
    getCheckModify() {
      checkModify().then(res => {
        if (res.resultCode == constant.SUCCESS && res.data) {
          this.checkModify = res.data;
        } else {
          this.$message.error(res.resultMsg)
        }
      })
    },
    //检查有效期截止日是否合法
    checkValidityDate(val, msg) {
      if (val.length != 8) {
        this.popMsg("有效期" + msg + "必须8位", "error");
        return false;
      }
      if (val) {
        let arr = val.split("/");
        let y = '';
        let m = '';
        let d = '';
        if (arr.length > 1) {
          y = arr[0];
          m = arr[1];
          d = arr[2];
        } else {
          y = val.substring(0, 4);
          m = val.substring(4, 6);
          d = val.substring(6, 8);
        }
        let time = y + "-" + m + "-" + d;
        let rep = /^((?!0000)[0-9]{4}-((0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-8])|(0[13-9]|1[0-2])-(29|30)|(0[13578]|1[02])-31)|([0-9]{2}(0[48]|[2468][048]|[13579][26])|(0[48]|[2468][048]|[13579][26])00)-02-29)$/
        let ret = new RegExp(rep);
        if (!ret.test(time)) {
          this.popMsg("请输入正确有效期" + msg, "error");
          return false;
        }
        return true;
      }
    }
  },
  watch: {
    "$route": {
      immediate: true,
      handler(route) {
        if (route.query.customerNo != undefined && route.query.customerNo != this.customerNo) {
          this.getCustomerInfo();
        }
        if (this.$route.query.update == 'N') {
          this.customerDetail = {};
          this.$set(this.customerDetail, 'customerType', 'P')
          this.$set(this.customerDetail, 'validityType', '3')
          this.$set(this.customerDetail, 'validityDate', '0')
          this.$set(this.customerDetail, 'startValidityDate', '0')
          this.$set(this.customerDetail, 'birthday', '0000/00/00')
          this.$set(this.customerDetail, 'nationality', 'CHN--中国')
        }
      }
    }
  },
  computed: {
    ...mapGetters(['tags']),
    reload() {
      return this.$store.state.loading.reload;
    }
  }
}

</script>

<style lang="less" scoped>
.fillcontain {
  padding-bottom: 0;

  .fastQuery {
    padding: 15px 20px 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e1e1e1;

    .fastQuery_title {
      color: #666;
      padding: 6px 0px;
    }
  }
}

.contain {
  background: #fff;
  padding: 10px;
  margin-bottom: 20px;
}

.common-box {
  padding-bottom: 15px;
}

.common-lab {
  line-height: normal !important;
  text-align: right;

  .labelName {
    text-align: right;
  }
}
</style>
